package com.example.administrator.zkdemo.core.interfaces;

import android.database.Cursor;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

/**
 * @author 丁可
 * @package com.example.administrator.zkdemo.core.interfaces
 * @fileName DatabaseInterface
 * @date 2018/11/19 0019 10:44
 * @description
 * @org http://www.gshbzw.com/ 人和致远数据服务有限责任公司
 */
public abstract interface DatabaseInterface {
    String ACTION_ON_TABLE_MODIFIED = "com.zkteco.android.core.db.TABLE_MODIFIED";
    String DB_ID = "id";
    String EXECSQL = "db-execsql";
    String INSERT = "db-insert";
    String OPEN = "db-open";
    String QUERY = "db-query";
    String SYSTEM_FREE = "system-free";
    String SYSTEM_GETINT = "system-getint";
    String SYSTEM_GETSTR = "system-getstr";
    String SYSTEM_INIT = "system-init";
    String SYSTEM_INIT_OPTIONTABLE = "system-init-optiontable";
    String SYSTEM_SETINT = "system-setint";
    String SYSTEM_SETSTR = "system-setstr";
    String TABLE_LOG = "database_log";
    String TABLE_NAME = "table-name";
    String TABLE_SETTING = "database_setting";
    String TRANSACTION = "db-transaction";
    String UPDATE = "db-update";
    String DELETE = "db-delete";

    Number executeInsert(String paramString, SQLCommand paramSQLCommand);

    Cursor executeQuery(String paramString, SQLCommand paramSQLCommand);

    void executeSql(String paramString1, String paramString2, Object[] paramArrayOfObject);

    boolean executeTransaction(String paramString, List<SQLCommand> paramList);

    void executeUpdate(String paramString, SQLCommand paramSQLCommand);

    int getIntOption(String paramString, int paramInt);

    String getStrOption(String paramString1, String paramString2);

    void open(String paramString, Integer paramInteger);

    int setIntOption(String paramString, int paramInt);

    int setStrOption(String paramString1, String paramString2);

    int systemFree();

    void systemInit();

    void systemInitOptionTable();

    enum Event {
        insert(INSERT, 1), delete(DELETE, 2), update(UPDATE, 3);
        private String tag;
        private int value;

        Event(String tag, int value) {
            this.tag = tag;
            this.value = value;
        }
    }

    class SQLCommand implements Serializable {
        private String[] arguments;
        private String sql;

        public String[] getArguments() {
            return this.arguments;
        }

        public String getSql() {
            return this.sql;
        }

        public void setArguments(String[] paramArrayOfString) {
            this.arguments = paramArrayOfString;
        }

        public void setSql(String paramString) {
            this.sql = paramString;
        }

        public String toString() {
            StringBuilder localStringBuilder = new StringBuilder();
            localStringBuilder.append("SQLCommand{sql='");
            localStringBuilder.append(this.sql);
            localStringBuilder.append('\'');
            localStringBuilder.append(", arguments=");
            localStringBuilder.append(Arrays.toString(this.arguments));
            localStringBuilder.append('}');
            return localStringBuilder.toString();
        }
    }

    class SQLCommand_Object
            implements Serializable {
        private Object[] arguments;
        private String sql;

        public Object[] getArguments() {
            return this.arguments;
        }

        public String getSql() {
            return this.sql;
        }

        public void setArguments(Object[] paramArrayOfObject) {
            this.arguments = paramArrayOfObject;
        }

        public void setSql(String paramString) {
            this.sql = paramString;
        }
    }
}
